package com.liang.cloud.Feign;

import com.liang.cloud.Dto.OrderDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: 余亮亮
 * @description:
 * @create: 2020-03-26 12:53:58
 **/
@FeignClient(value = "cloud-provider-order")
@Component
public interface OrderFeign {
    @PostMapping("/order/api/create")
    OrderDTO create(@RequestBody OrderDTO orderDTO);

    @GetMapping("/order/api/findOne/{orderId}")
    OrderDTO findOne(@PathVariable("orderId") String orderId);


    @GetMapping("/order/api/findList")
    Page<OrderDTO> findList(@RequestParam("buyerOpenid") String buyerOpenid,@RequestBody Pageable pageable);


    @PostMapping("/order/api/cancel")
    OrderDTO cancel(@RequestBody OrderDTO orderDTO);


    @PostMapping("/order/api/finish")
    OrderDTO finish(@RequestBody OrderDTO orderDTO);

    @PostMapping("/order/api/paid")
    OrderDTO paid(@RequestBody OrderDTO orderDTO);


    @GetMapping("/order/api/findList")
    Page<OrderDTO> findList(Pageable pageable);

    @GetMapping("/order/api/findOneWithSafe/{orderId}")
    OrderDTO findOneWithSafe(@PathVariable("openid") String openid, @PathVariable("orderId") String orderId);


    @PostMapping("/order/api/cancelWithSafe")
    OrderDTO cancel(@PathVariable("openid")String openid, @PathVariable("orderId") String orderId);



    @GetMapping("/order/api/findByOpenid/{openid}")
    List<OrderDTO> findByOpenid(@PathVariable("openid") String openid);
}
